#ifndef QROBOT_H
#define QROBOT_H
#include<QGraphicsItem>
#include<QPixmap>

QT_BEGIN_NAMESPACE
class QGraphicsSceneMouseEvent;
class QParalleAnimationGroup;
QT_END_NAMESPACE

class QRobotPart:public QGraphicsObject
{
public:
    QRobotPart(QGraphicsItem* pParent = nullptr);

protected:
    virtual void dropEvent(QGraphicsSceneDragDropEvent *event) override;
    virtual void dragEnterEvent(QGraphicsSceneDragDropEvent *event) override;
    virtual void dragLeaveEvent(QGraphicsSceneDragDropEvent *event) override;

    QColor m_Color = Qt::lightGray;
    bool m_bDragOver = false;
};

class QRobotHead:public QRobotPart
{
public:
    QRobotHead(QGraphicsItem* pParent = nullptr);
    virtual QRectF boundingRect() const override;
    virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = nullptr) override;

protected:
    virtual void dragEnterEvent(QGraphicsSceneDragDropEvent *event) override;
    virtual void dropEvent(QGraphicsSceneDragDropEvent *event) override;

private:
    QPixmap m_pixmap;

};


class QRobotTorso:public QRobotPart
{
public:
    using QRobotPart::QRobotPart;
    virtual QRectF boundingRect() const override;
    virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = nullptr) override;
};

class QRobotLimb:public QRobotPart
{
public:
    QRobotLimb(QGraphicsItem* pParent = nullptr );
    virtual QRectF boundingRect() const override;
    virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = nullptr) override;
};

class QRobot:public QRobotPart
{
public:
    QRobot(QGraphicsItem* pParent = nullptr );
    virtual QRectF boundingRect() const override;
    virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = nullptr) override;
};

#endif // QROBOT_H
